﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<QualificationLevel>>" %>
<%@ Import Namespace="Resources" %>
<%@ Import Namespace="ViewRes" %>
  <script type="text/javascript">
//       $(function () {
//            $("a.deleteLink").live("click", function () {
//                deleteEntity('<%:DiplomaResources.DoYouConfirmDeletion%>', groupDeleted);
//                return false;
//            });           
//        });
      
        var $link;

        function loadGroupsList() {
            $link = $("#QualificationLevelId option:selected").val();
            $("#divGroupsList").load($link);
        }

        function editGroup(link) {
            openDialog(link, '<%:AdministratorsStrings.EditGroup%>', function() {
                $("#divDialog form").attr("onSuccess", "loadActiveEntries();");
            });
        }

        function groupDeleted() {
            loadActiveEntries();
        }

        function loadActiveEntries() {
            $("#divGroupsList").load($link);
        }

 </script>

 <div style="margin: 1em auto; position: relative; text-align: left;">
        <div>
            <span class="largeText">
                <%:AdministratorsStrings.QualificationLevel%>
            </span>
            <select name="QualificationLevelId" id="QualificationLevelId" onchange="loadGroupsList()">
                <option class="disabled">
                    <%:AdministratorsStrings.ChooseLevel%></option>
                <%
                    foreach (QualificationLevel level in Model)
                    {%>
                <option value="<%=Url.RouteUrl("Default",
                                                       new
                                                           {
                                                               controller = "StudentsGroups",
                                                               action = "Level",
                                                               id = level.QualificationLevelId
                                                           })%>">
                    <%=level.ToString()%></option>
                <%
                    }%>
            </select>
        </div>
        <br />
        <div id="divGroupsList">
        </div>
    </div>